package com.makao.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.EurekaClient;

@RestController
public class Controller {
	@Autowired
	private EurekaClient discoveryClient;
	 @GetMapping("/eureka-instance")
	    public String serviceUrl() {
	        InstanceInfo instance = discoveryClient.getNextServerFromEureka("CLOUD-EUREKA-CLIENT-CLUSTER", false);
	        return instance.getHomePageUrl();
	    }
}